Skip to content

fix(create): add vp create e2e tests and fix yarn/bun migration bugs#1317

Open
fengmk2 wants to merge 23 commits intomainfrom
add-vp-create-e2e
Open

fix(create): add vp create e2e tests and fix yarn/bun migration bugs#1317
fengmk2 wants to merge 23 commits intomainfrom
add-vp-create-e2e

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Apr 6, 2026

Summary

Motivated by #1297 the .yarnrc template fix revealed that vp create had no e2e test coverage, making it easy for template bugs to ship undetected.

  • Add a new GitHub Actions workflow (test-vp-create.yml) that e2e tests vp create across all 3 built-in templates (monorepo, application, library) and all 4 package managers (pnpm, npm, yarn, bun) — 12 test combinations
  • Fix bun monorepo migration writing empty catalog with dangling catalog: references when using file: protocol
  • Fix yarn standalone projects missing .yarnrc.yml with nodeLinker: node-modules
  • Pass --no-frozen-lockfile from vp create in CI so yarn Berry can create fresh lockfiles

Changes

New: vp create e2e test workflow

  • Uses the same tgz-packaging approach as ecosystem-ci: build → pack → install vp from tgz → run vp create with VP_OVERRIDE_PACKAGES/VP_VERSION pointing to local packages
  • Each test verifies: project structure, correct lockfile, vite-plus@0.0.0 installed, vp check, and build/test commands
  • Monorepo tests run vp run ready twice and assert 100% cache hit on the second run
  • Triggered on push to main (path-filtered), PRs with test: create-e2e label, or create-related file changes

Fix: bun monorepo catalog with file: protocol

  • rewriteBunCatalog() unconditionally set all overrides to catalog: but skipped file: entries from the catalog, leaving unresolvable references
  • Now uses file: paths directly in overrides when the value starts with file:

Fix: yarn standalone projects

  • rewriteYarnrcYml() now sets nodeLinker: node-modules when absent (yarn 4 defaults to PnP)
  • rewriteStandaloneProject() now calls rewriteYarnrcYml() for yarn projects (previously only called for monorepos)
  • vp create passes --no-frozen-lockfile to vp install in CI environments

Test plan

  • All 12 matrix jobs pass in CI (3 templates × 4 package managers)
  • Existing migration tests pass (vp test run packages/cli/src/migration/)
  • New bun-catalog-file-protocol.spec.ts test verifies the bun override fix

🤖 Generated with Claude Code

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 6, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 365569e
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69d46e79a9341b00082dd7b2

Copy link
Copy Markdown
Member Author

fengmk2 commented Apr 6, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the add-vp-create-e2e branch from b6bb893 to fe223c7 Compare April 6, 2026 08:25
@fengmk2 fengmk2 self-assigned this Apr 6, 2026
@fengmk2 fengmk2 force-pushed the add-vp-create-e2e branch from 79206b2 to a938cf5 Compare April 6, 2026 09:19
@fengmk2 fengmk2 changed the title ci: add e2e tests for vp create across all templates and package managers feat(ci): add vp create e2e tests and fix yarn/bun migration bugs Apr 6, 2026
@fengmk2 fengmk2 added the test: e2e Auto run e2e tests label Apr 6, 2026 — with Graphite App
fengmk2 added 16 commits April 7, 2026 10:05
…nagers

Test all 3 built-in templates (monorepo, application, library) with all
4 package managers (pnpm, npm, yarn, bun) using the same tgz-packaging
approach as ecosystem-ci. Each test verifies project structure, lockfiles,
local package installation, and successful builds.
Split template-args from create-args so --package-manager is placed
before the -- separator. Move VP_OVERRIDE_PACKAGES/VP_VERSION to
job-level env. Add ls -la for debugging lockfile issues.
- Add VP_FORCE_MIGRATE=1 so the library template's existing vite-plus
  dep gets overridden with the local tgz (fixes all 4 library tests)
- Exclude yarn (all templates): yarn install fails with absolute file:
  paths to tgz files
- Exclude bun monorepo: migration writes empty catalog with catalog:
  references when using file: protocol
…empty catalog

When VP_OVERRIDE_PACKAGES uses file: protocol paths (e.g., in CI with
local tgz packages), rewriteBunCatalog() was unconditionally setting all
overrides to 'catalog:' while skipping file: entries from the catalog
itself, resulting in unresolvable 'catalog:' references pointing to an
empty catalog.

Now file: paths are used directly in overrides, matching npm behavior.
Two issues caused yarn install to fail in CI for newly created projects:

1. In CI (CI=true), yarn Berry defaults to enableImmutableInstalls which
   prevents creating a new lockfile. Pass --no-frozen-lockfile to
   vp install since vp create always needs to generate a fresh lockfile.

2. Standalone yarn projects had no .yarnrc.yml created during migration.
   Without nodeLinker: node-modules, yarn 4 defaults to PnP which
   doesn't work with vite-plus. Now rewriteYarnrcYml() ensures
   nodeLinker is set and is called for standalone projects too.

Also removes all yarn exclusions from the create e2e test workflow
(full 12-job matrix now enabled).
… .yarnrc.yml

Revert passing --no-frozen-lockfile to vp install from vp create.
Instead, set enableImmutableInstalls: false in .yarnrc.yml so yarn
Berry can create/update lockfiles in CI where it defaults to immutable.
Let yarn Berry use its default behavior to see what errors occur in CI
with immutable installs enabled.
Yarn Berry defaults to enableImmutableInstalls in CI, preventing
lockfile creation. Pass --no-frozen-lockfile when CI env is set so
vp create can generate fresh lockfiles.
Pass --no-frozen-lockfile to vp install only from vp create in CI,
so yarn Berry can create fresh lockfiles without affecting vp install
behavior in other contexts.
Yarn Berry enables hardened mode on public PRs which blocks lockfile
creation (YN0028). Set YARN_ENABLE_HARDENED_MODE=0 so vp create can
generate fresh lockfiles in the e2e test.
Step-level env with value '0' wasn't propagated through the vp create →
vp install → yarn install chain. Move to job-level env with boolean
false so it's available to all child processes.
@fengmk2 fengmk2 force-pushed the add-vp-create-e2e branch from 7de2e6c to 174331e Compare April 7, 2026 02:08
@fengmk2 fengmk2 changed the title feat(ci): add vp create e2e tests and fix yarn/bun migration bugs fix(ci): add vp create e2e tests and fix yarn/bun migration bugs Apr 7, 2026
@fengmk2 fengmk2 changed the title fix(ci): add vp create e2e tests and fix yarn/bun migration bugs fix(create): add vp create e2e tests and fix yarn/bun migration bugs Apr 7, 2026
fengmk2 added 3 commits April 7, 2026 10:11
Yarn Berry's hardened mode on public PRs forbids lockfile creation but
allows updating an existing one. The YARN_ENABLE_HARDENED_MODE env var
cannot override this auto-detection. Instead, create an empty yarn.lock
during migration so yarn install treats it as an update.
@fengmk2 fengmk2 marked this pull request as ready for review April 7, 2026 02:43
@fengmk2 fengmk2 requested review from branchseer and cpojer April 7, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: e2e Auto run e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants